package nowCoder;

import java.util.Scanner;

/**
 * @Auther: zzx
 * @Date: 2024.02.24/2/3
 */
public class HJ36 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String x = in.next();
        String y = in.next();
        int[] xx = new int[26];
        for (int i = 0; i < x.length(); i++) {
            int c = x.charAt(i);
            for (int j = 0; j < xx.length; j++) {
                if (xx[j] == 0 || xx[j] == c){
                    xx[j] = c;
                    break;
                }
            }
        }
        for (int i = 0; i < 26; i++) {
            int c = i+97;
            for (int j = 0; j < xx.length; j++) {
                if (xx[j] == 0 || xx[j] == c){
                    xx[j] = c;
                    break;
                }
            }
        }
        for (int i = 0; i < y.length(); i++) {
            int c = y.charAt(i) - 97;
            System.out.print((char)xx[c]);
        }
    }
}
